.TH llapi_path2parent 3 "2014 Oct 13" "Lustre User API"
.SH NAME
llapi_path2parent, llapi_fd2parent \- Retrieve <parent FID>/name(s) for an entry
in Lustre.
.SH SYNOPSIS
.nf
.B #include <lustre/lustreapi.h>
.PP
.BI "int llapi_path2parent(const char *" path ", unsigned int " linkno ","
.BI "                      struct lu_fid *" parent_fid ", char *" name ","
.BI "                      size_t " name_size );

.BI "int llapi_fd2parent(int " fd ", unsigned int " linkno ","
.BI "                    struct lu_fid *" parent_fid ", char *" name ","
.BI "                    size_t " name_size );
.sp
.fi
.SH DESCRIPTION
.PP
.BR llapi_path2parent()
for link number
.I linkno
stores the FID of the parent directory into
.I parent_fid
and the NUL-terminated name of the entry into the buffer
.I name
which is expected to be of size
.IR name_size .
If
.I linkno
should be initialized to
.B -1
when starting to iterate over all links of a file.  The function
.B llapi_fd2parent()
behaves similarly except that it operates on an open file descriptor
instead of a path.
.sp
.SH RETURN VALUES
.LP
0 is returned on success or a negative errno value on failure.
.SH ERRORS
.TP 15
.SM -ENODATA
linkno has reached the total link count of the file.
.TP
.SM -ENOTTY
.I path
or
.I fd
does not reside on a Lustre filesystem.
.TP
.SM -ENOENT
.I path
does not exist.
.TP
.SM -EINVAL
An invalid argument was specified.
.TP
.SM -EOVERFLOW
The given buffer was too small to hold the pathname.
.TP
.SM -EPERM
The file cannot be open by user or CAP_DAC_READ_SEARCH is not granted.
.SH "SEE ALSO"
.BR lfs-path2fid (1),
.BR llapi_fid2path (3),
.BR llapi_path2fid (3),
.BR lustreapi (7)
